import time

import django.utils.timezone

from app01 import models
from django import forms

from app01.utils.kk import md5


class LoginFrom(forms.ModelForm):
    verify = forms.CharField(label="验证码")

    class Meta:
        model = models.User
        fields = ['name', 'password', "verify"]

    def clean_password(self):
        password = self.cleaned_data["password"]
        return md5(password)


class NoteBookModelForm(forms.ModelForm):
    class Meta:
        model = models.NoteBook
        fields = "__all__"


class NoteModelForm(forms.ModelForm):
    class Meta:
        model = models.Note
        exclude = ['tag']


class NoteBookEditModelForm(forms.ModelForm):
    class Meta:
        model = models.NoteBook
        fields = ['title']
